﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;

namespace LCTMoodle.Models.ViewModels
{
    public class QuyenViewModel : Model
    {
        public int ma { get; set; }
        public string tenQuyen { get; set; }
        public string quyen { get; set; }
        public string chuoiMaQuyenTienQuyet { get; set; }

        public override void assignModel(SqlDataReader dr)
        {
            for (int i = 0; i < dr.FieldCount; i++)
            {
                switch (dr.GetName(i))
                {
                    case "Ma":
                        ma = (dr.IsDBNull(i)) ? 0 : dr.GetInt32(i); break;
                    case "TenQuyen":
                        tenQuyen = (dr.IsDBNull(i)) ? null : dr.GetString(i); break;
                    case "Quyen":
                        quyen = (dr.IsDBNull(i)) ? null : dr.GetString(i); break;
                    case "ChuoiMaQuyenTienQuyet":
                        quyen = (dr.IsDBNull(i)) ? null : dr.GetString(i); break;
                    default:
                        break;
                }
            }
        }
    }
}